package com.crm.crm.controller;

import com.crm.crm.domain.RulePool;
import com.crm.crm.domain.vo.business.result.Result;
import com.crm.crm.service.impl.RuleServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/rule")
public class RuleController {
    @Autowired
    private RuleServiceImpl ruleService;

    @PostMapping("/pool")
    public Result addRulePool(@RequestBody RulePool rulePool) {
        ruleService.addOrUpdate(rulePool);
        return Result.success();
    }

    /*线索配置规则修改*/
    @PutMapping("/pool")
    public Result updateRulePool(@RequestBody RulePool rulePool) {

        ruleService.addOrUpdate(rulePool);
        return Result.success();
    }

    /*获取规则*/
    @GetMapping("/pool/{type}")
    public Result getRulePool(@PathVariable Integer type) {
        return Result.success(ruleService.getRulePool(type));
    }
}
